<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>

<script>
    var ws = new WebSocket('ws://127.0.0.1:8111/myWS');

    ws.onopen = function(evt) {
        console.log('Connection open ...');
        ws.send('Hello WebSockets!');
        setInterval(()=>{
            ws.send('Hello WebSockets!');
        }, 2000)
    };

    // ws.onmessage = function(evt) {
    //     console.log('Received Message: ' + evt.data);
    //     ws.close();
    // };
    //
    // ws.onclose = function(evt) {
    //     console.log('Connection closed.');
    // };
</script>
</html>